package com.example.com.daervideo.myViews;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.widget.EditText;

import com.example.com.daervideo.R;


/**
 * Created by i7-1 on 2018/11/22.
 */

@SuppressLint("AppCompatCustomView")
public class MyEditText extends EditText {

    private Paint paint;

    public MyEditText(Context context) {
        super(context);
        init();
    }

    public MyEditText(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public MyEditText(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    private void init() {
        paint = new Paint();
        paint.setColor(this.getResources().getColor(R.color.white));
        paint.setAntiAlias(true);
        paint.setDither(true);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        int right = getRight();
        int height = getMeasuredHeight();
        canvas.drawLine(0, height - 1, right, height, paint);
    }
}
